<!DOCTYPE html>
<html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <title>基础配置</title>
        <link rel="stylesheet" href="../css/bootstrap.css">
        <script src="../lib/jquery.js"></script>
        <script src="../lib/bootstrap.js"></script>
        <!--工具方法-->
        <script src="../scripts/global.js"></script>
        <!--插件-->
        <script src="../scripts/jquery.smart-form.js"></script>
        <script src="../lib/jquery-file-upload/vendor/jquery.ui.widget.js"></script>
        <script src="../lib/jquery-file-upload/jquery.fileupload.js"></script>
    </head>
    
    <body>
        <div class="panel panel-default">
            <div class="panel-heading"><label>基础配置</label></div>
            <div class="panel-body">
                <form action="#" id="formContainer" class="form form-horizontal"></form>
            </div>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading"><label>介绍</label></div>
            <div class="panel-body">
                <h3>支持的表单元素包括:text、select、radio、checkbox、datetime、search、textarea、自定义、上传图片</h3>
                <blockquote>
                    note:此处的图片上传仅生成结构，没有绑定事件的处理，如需自动处理相关事件，需要引用jquery-file-upload插件，然后调用
                    <code>global.Fn.InitPlugin('img','formContainer')</code>
                </blockquote>
            </div>
        </div>
        <script>
            $(function () {
                var eles=[
                        {ele:{type:'text',name:'UserName',title:'用户名:'}},
                        [
                            {ele:{type:'radio',name:'sex',title:'性别:',items:[{text:'男',value:1},{text:'女',value:2}]}},
                            {ele:{type:'checkbox', name:'plant',title:'使用平台:',items:[{text:'APP',value:'app'},{text:'web',value:'web'}]}},   
                        ],
                        {ele:{type:'select',name:'province',title:'省份:',withNull:true,items:[{text:'广东',value:'GD'},{text:'湖南',value:'HN'}]}},
                        {ele:{type:'datetime',name:'FromeDate',title:'有效期:'}},
                        {ele:{type:'search',name:'selectName',title:'选择:'}},
                        {ele:{type:'textarea',name:'address',title:'地址:'}},
                        {ele:{pre:{text:'<input type="radio" />'},type:'text',name:'pre',title:'叉前面:'}},
                        {ele:{next:{text:'<input type="radio" />'},type:'text',name:'next',title:'叉后面:'}},
                        {ele:{pre:{text:'<input type="checkbox" />'},next:{text:'$'},type:'text',name:'pre&next',title:'前后皆叉:'}},
                        {ele:{type:'img',id:'a1',name:'files',title:'图片',extendAttr:{url:'',filed:'headimg',handle:'single'}}}
                ];
                //隐藏表单元素主要用于编辑时候后台可以区别开来
                var hides = [{ id: 'GUID' }];
    
                var bsForm = new BSForm({ eles: eles, hides: hides, autoLayout:true }).Render('formContainer',function(sf){
                    global.Fn.InitPlugin('img','formContainer')
                });
            });
        </script>
    </body></html>